<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>bookshow</title>
</head>
<body>
<div class="showbooks">
    <a href="#" class="content-item" th:each="book:${books}">
        <li th:data-id="${book.bookId}"><img class="cover-box" th:src="${book.cover}" /></li>
        <li  class="book-title" th:text="${book.bookName}" ></li>
        <li class="book-author" th:text="${book.author}"></li>
    </a>
    <button class="btn1">加载更多</button>
</div>
<script>
    $(".content-item").on('click',function () {
        var bookId=$(this).children('li').attr("data-id");
        console.log(bookId);
        $(".content-item").attr("href","http://localhost:8080/bookdetail?bookId="+bookId);
    });
</script>
</body>
</html>